<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>嘉和急诊系统-信息查看</title>
    <style type="text/css">
        /* gridtable */
        table.gridtable {
            font-family: verdana,arial,sans-serif;
            font-size: 14px;
            color: #333333;
            border-width: 1px;
            border-color: #666666;
            border-collapse: collapse;
        }

            table.gridtable th {
                border-width: 1px;
                padding: 8px;
                border-style: solid;
                border-color: #666666;
                background-color: #dedede;
            }

            table.gridtable td {
                border-width: 1px;
                padding: 8px;
                border-style: solid;
                border-color: #666666;
                background-color: #ffffff;
            }
        /* /gridtable */

        /* imagetable */
        table.imagetable {
            font-family: verdana,arial,sans-serif;
            font-size: 14px;
            color: #333333;
            border-width: 1px;
            border-color: #999999;
            border-collapse: collapse;
        }

            table.imagetable th {
                background: #b5cfd2 url('cell-blue.jpg');
                border-width: 1px;
                padding: 8px;
                border-style: solid;
                border-color: #999999;
            }

            table.imagetable td {
                background: #dcddc0 url('cell-grey.jpg');
                border-width: 1px;
                padding: 8px;
                border-style: solid;
                border-color: #999999;
            }
        /* /imagetable */
        /* altrowstable */

        table.altrowstable {
            font-family: verdana,arial,sans-serif;
            font-size: 14px;
            color: #333333;
            border-width: 1px;
            border-color: #a9c6c9;
            border-collapse: collapse;
        }

            table.altrowstable th {
                border-width: 1px;
                padding: 8px;
                border-style: solid;
                border-color: #a9c6c9;
            }

            table.altrowstable td {
                border-width: 1px;
                padding: 8px;
                border-style: solid;
                border-color: #a9c6c9;
            }

        .oddrowcolor {
            background-color: #d4e3e5;
        }

        .evenrowcolor {
            background-color: #c3dde0;
        }

        table.hovertable {
            font-family: verdana,arial,sans-serif;
            font-size: 14px;
            color: #333333;
            border-width: 1px;
            border-color: #999999;
            border-collapse: collapse;
        }

            table.hovertable th {
                background-color: #c3dde0;
                border-width: 1px;
                padding: 8px;
                border-style: solid;
                border-color: #a9c6c9;
            }

            table.hovertable tr {
                background-color: #d4e3e5;
            }

            table.hovertable td {
                border-width: 1px;
                padding: 8px;
                border-style: solid;
                border-color: #a9c6c9;
            }
        /* /hovertable */
        body {
            font-size: 18px;
        }
    </style>
    <script src="../Scripts/Vue/axios.min.js"></script>
    <script src="../Scripts/Vue/vue.min.js"></script>
    <script type="text/javascript">
        //变量
        var header = { "auth": "jhecis" };
        var Vueapp;
        //测试地址 http://localhost:8090/WebFrom/TriageInfoView.html?pvid=44bd22da-c846-434e-bfa8-8d734c85c1ba
        //url地址获取
        function GetGuDing(Ext) {
            //return "http://localhost:8095" + Ext;
            var Curpath = window.document.location.href;
            var rootpath = Curpath.split("//")[0] + "//" + Curpath.split("//")[1].split("/")[0];
            console.log(rootpath);
            var InterFaceUrl = rootpath + Ext;
            console.log(InterFaceUrl);
            return InterFaceUrl;
        }
        //pvid获取基础信息
        function GetPatInfoByPvid(pvid) {
            axios({
                method: 'get',
                url: GetGuDing('/api/Triage/GetPatientVisitInfoByPvid?pvid=' + pvid),
                headers: header,
                responseType: 'json'
            }).then(function (response) {
                var res = response.data.data;
                Vueapp.Pat = res;
                console.log('pvid患者数据');
                console.log(res);
            }).catch(function (error) {
                console.log(error);
            });
        }
        //patientid获取基础信息
        function GetPatInfoByPatient(PatientId, func) {
            axios({
                method: 'get',
                url: GetGuDing('/api/Triage/GetPatientVisitInfoByPatientId?PatientId=' + PatientId),
                headers: header,
                responseType: 'json'
            }).then(function (response) {
                var res = response.data.data;
                Vueapp.Pat = res;
                console.log('patient患者数据');
                console.log(res);
                func();
            }).catch(function (error) {
                console.log(error);
            });
        }

        //获取生命体征
        function GetPatVitByPvid(pvid) {
            axios({
                method: 'get',
                url: GetGuDing('/api/Triage/GetVitalsignRecordByTid?tid=' + pvid),
                headers: header,
                responseType: 'json'
            }).then(function (response) {
                var res = response.data.data;
                Vueapp.Vit = res;
                console.log('pvid患者生命体征');
                console.log(res);
            }).catch(function (error) {
                console.log(error);
            });
        }
        //获取评分数据
        function GetPatScoreByPvid(pvid) {
            axios({
                method: 'get',
                url: GetGuDing('/api/Triage/GetTriage_ScoreByPvid?pvid=' + pvid),
                headers: header,
                responseType: 'json'
            }).then(function (response) {
                var res = response.data.data;
                Vueapp.Score = res;
                console.log('pvid评分数据');
                console.log(res);
            }).catch(function (error) {
                console.log(error);
            });
        }
        //界面加载完毕
        window.onload = function () {
            //根节点
            Vueapp = new Vue({
                el: "#app",
                data: {
                    Pat: {},
                    Vit: {},
                    Score: {},
                    context: "1111"
                },
                methods: {
                    onSave: function (obj) {
                        console.log('点击了提交');
                        SaveData();
                    }
                }
            })
            //加载数据
            LoadData();
        }

        function LoadData() {
            var str = window.location.href;
            var pos_pvid = str.indexOf("pvid=");
            var pos_empi = str.indexOf("empi=");
            if (pos_pvid >= 0) {
                var parastr = str.substring(pos_pvid + 5);
                var para = parastr.split("&");
                var value = para[0];
                GetPatInfoByPvid(value);
                GetPatVitByPvid(value);
                GetPatScoreByPvid(value);
                console.log("参数名：" + name + "，参数值：" + value);
            } else if (pos_empi >= 0) {
                var parastr = str.substring(pos_empi + 5);
                var para = parastr.split("&");
                var value = para[0];
                GetPatInfoByPatient(value, function () {
                    GetPatVitByPvid(Vueapp.Pat.PVID);
                    GetPatScoreByPvid(Vueapp.Pat.PVID);
                });
            }
            else {
                console.log("没有参数");
            }
        }
    </script>
</head>
<body style="width: 550px;">
    <div id="app" style="width: 550px;">
        <table class="imagetable" style="float: left; width: 550px;">
            <tbody>
                <tr style="font-weight: 800;">
                    <td>姓名</td>
                    <td>病历号</td>
                    <td>分诊等级</td>
                    <td>分诊时间</td>
                    <td>分诊去向</td>
                </tr>
                <tr>
                    <td>{{Pat.PATIENTNAME}}</td>
                    <td>{{Pat.PATIENTID}}</td>
                    <td style=""> {{Pat.LEVELSYMBOL}}</td>
                    <td> {{Pat.VISITDATE}}</td>
                    <td>{{Pat.TRIAGETARGETNAME}} </td>
                </tr>
                <tr>
                    <td colspan="5">
                        <label style="font-weight: 700;">分诊主诉</label>
                        <label style="color: blue;"> {{Pat.MAINCHIEF}} </label>
                    </td>
            </tbody>
        </table>
        <table class="hovertable" style="float: left; width: 550px; margin: 5px 0px 0px 0px;">
            <tr>
                <th colspan="4">生命体征与评分</th>
            </tr>
            <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
                <td>体温:{{Vit.TEMP}}</td>
                <td>脉搏:{{Vit.PULSE}}</td>
                <td>血压:{{Vit.SBP}} / {{Vit.DBP}}</td>
            </tr>
            <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
                <td>呼吸:{{Vit.BREATHRATE}}</td>
                <td>SPO<sub>2</sub>:{{Vit.SPO2}}</td>
                <td>血糖:{{Vit.BLOODSUGAR}}</td>
            </tr>
            <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
                <td>心率:{{Vit.HEARTRATE}}</td>
                <td>意识:{{Vit.MENTALITY}}</td>
                <td>CRT:{{Vit.CRT}}</td>
            </tr>
            <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
                <td>Pews评分：{{Score.PEWS_SCORE}} </td>
            </tr>
        </table>
    </div>
</body>
</html>